package com.ruoyi.web.controller.api.cbs;

import com.ruoyi.cbs.project.domain.vo.ProjectSelectVo;
import com.ruoyi.cbs.project.services.ProjectServices;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 项目
 *
 * @author rsj
 * @date 2022-04-04
 */
@Slf4j
@Api("项目信息")
@RestController
@RequestMapping("/api/project")
public class ApiProjectController extends BaseController {
    @Autowired
    private ProjectServices projectServices;

    /**
     * 查询项目列表
     */
    @ApiOperation("查询项目列表")
    @GetMapping("/select")
    public AjaxResult select(String projectName, String status)
    {
        // 未开工项目
        String searchStatus = "1".equals(status) ? "2" : "1";
        List<ProjectSelectVo> list = projectServices.selectProjectList(projectName, searchStatus);
        return AjaxResult.success(list);
    }

    /**
     * 查询项目列表
     */
    @ApiOperation("查询项目列表")
    @GetMapping("/selectAll")
    public AjaxResult selectAll(String projectName)
    {
        List<ProjectSelectVo> list = projectServices.selectProjectList(projectName, null);
        return AjaxResult.success(list);
    }

}

